/**
 * Copyright © 2018 eqxiu.com 北京中网易企秀科技有限公司  All rights reserved.
 */
package com.eqxiu.iom.msg.consumer;

import com.alibaba.fastjson.JSONObject;
import com.eqxiu.common.codec.CodecFactory;
import com.eqxiu.iom.msg.dto.BehaviorEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.MessageProperties;

/**
 * @description 测试多消费者
 * @author wangl
 * @date 2020-05-29
 * @modified by xxx
 */
//@Component
public class UserBehaviorEventConsumer2 {
    public static final Logger LOGGER = LoggerFactory.getLogger(UserBehaviorEventConsumer2.class);

//    @RabbitListener(queuesToDeclare=@Queue("${queue.name.user.behavior}"))
    public void receiveMessage(byte[] data, MessageProperties properties) {
        try {
            BehaviorEvent event = CodecFactory.getCodec().deSerialize(data, BehaviorEvent.class);
            LOGGER.info("revceive message event 2: {}.", JSONObject.toJSONString(event));
        } catch (Exception e) {
            LOGGER.error("UserBehaviorEventConsumer 2 data: " + JSONObject.toJSONString(data) + ", exception: ", e);
        }
    }

}